package com.lance.modules.front.login.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hazelcast.util.StringUtil;
import com.lance.core.base.BaseService;
import com.lance.modules.front.login.entity.UserEntity;
import com.lance.modules.front.login.mapper.UserMapper;

@Service("userService")
public class UserService implements BaseService{
	
	@Autowired
	private UserMapper userMapper;
	
	public UserEntity get(UserEntity userEntity){	
		return userMapper.get(userEntity);
	}
	
	public List<UserEntity> listUser(){
		return userMapper.listUser();
	}
	
	public void save(UserEntity userEntiry){
		if(StringUtil.isNullOrEmpty(userEntiry.getId())){
			userMapper.insert(userEntiry);
		}else{
			userMapper.update(userEntiry);
		}
	}
	
	public UserEntity login(UserEntity userEntity){
		return userMapper.login(userEntity);
	}
}
